package cn.edu.zafu.bigdata.x.zhouyuyan.work7;

public class ArithmeticExceptionHandler {
    public static double divide(int a, int b){
        if (b == 0){
            throw new ArithmeticException("除数不能为零");
        }
        return (double) a / b;
    }

    public static void main(String[] args) {
        try {
            int fz = 10;
            int fm = 0;
            double result = divide(fz,fm);
            System.out.println("结果是:"+result);
        }catch (ArithmeticException e){
            System.err.println("错误:"+e.getMessage());
        }
    }
}
